/*
 * DictionaryRecordContent.java
 *
 * Copyright(c) 2011
 * Michael Kroez
 * kroez@studiorutton.de
 *
 * All rights reserved.
 *
 * $Id$
 * 
 */

package de.studiorutton.gerengdic.dictionary;

import de.studiorutton.gerengdic.databaseaccess.ContentAccess;
import de.studiorutton.gerengdic.dictionary.records.LeftRightValuesRecord;
import de.studiorutton.gerengdic.dictionary.records.RecordBothSidesComparer;
import de.studiorutton.gerengdic.dictionary.records.RecordComparer;
import de.studiorutton.gerengdic.dictionary.records.RecordLeftComparer;
import de.studiorutton.gerengdic.dictionary.records.RecordRightComparer;

public class DictionaryRecordContent extends DictionaryRecord {
	public LeftRightValuesRecord lrvr;
	private static RecordComparer rc;

	public DictionaryRecordContent( int errors,
			LeftRightValuesRecord lrvr) {
		super(TYPE_CONTENT, errors);
		this.lrvr = lrvr;
	}

	public static void setLanguage(int language) {
		if (language == ContentAccess.LANGUAGE_LEFT)
			rc = new RecordLeftComparer();
		else if (language == ContentAccess.LANGUAGE_RIGHT)
			rc = new RecordRightComparer();
		else
			rc = new RecordBothSidesComparer();
	}
	
	public LeftRightValuesRecord getLrvr() {
		return lrvr;
	}
	
	public boolean greaterThan( DictionaryRecordContent object ) {
		return rc.greaterThan( lrvr, object.lrvr);
	}
	
	public boolean lessThan( DictionaryRecordContent object ) {
		return rc.lessThan( lrvr, object.lrvr );
	}
	
	public boolean equalAs( DictionaryRecordContent object ) {
		return rc.equals( lrvr, object.lrvr );
	}

}
